import React from "react"
import {
  withState,
  withHandlers,
  compose,
  lifecycle
} from "recompose"
import {postParam, postJSON, get} from "server"
import {env, DEV} from "project-config"
import {read} from "zr-react-toolbox"

const rejectCompose = compose(
  withState('rejectData', '$rejectData', {}),
  withHandlers({
    getServerData: ({$rejectData}) => {
      return (auditId) => {
        console.info(auditId, '----')
        get(`/myShop/auditInfo/${auditId}`)
          .then(d => $rejectData(d))
      }
    }
  }),
  lifecycle({
    componentDidMount() {
      const {getServerData, data} = this.props
      getServerData(read(data, "0.auditId"))
    }
  })
)

export default rejectCompose